{include file="header.html"}
<div id="page_main" class="main-right">
  <div id="rightTop">
    <p>{$lang.integral_manage}</p>
    <ul class="subnav">
      <li><span>{$lang.integral_list}</span></li>
      <li><a class="btn1" href="{url route='integral/setting'}">{$lang.integral_setting}</a></li>
    </ul>
  </div>
  <div class="search-form clearfix">
    <form method="get" id="formSearch">
      <input type="hidden" name="r" value="integral/index" />
      {$lang.username}
      <input class="queryInput" type="text" name="username" value="{$smarty.get.username|escape}" />
      <input type="submit" class="formbtn" value="{$lang.query}" />
      <!--{if $filtered}--> 
      <a class="formbtn formbtn1" href="{url route='integral/index'}">{$lang.cancel_query}</a> 
      <!--{/if}-->
    </form>
  </div>
  <div id="flexigrid"></div>
</div>
<script type="text/javascript">
$(function(){
    $("#flexigrid").flexigrid({
		url: url(['integral/index', $("#formSearch").serializeJson()]),
    	colModel : [
    		{ display: '{$lang.operation}', name : 'operation', width : 200, sortable : false, align: 'center', className: 'handle'},
			{ display: 'ID', name : 'userid', width : 200, sortable : true, align: 'center'},
			{ display: '{$lang.username}', name : 'username', width : 200, sortable : true, align: 'center'},
			{ display: '{$lang.amount}', name : 'amount', width : 200, sortable : true, align: 'center'}		
    	],
        buttons : [
			{ display: '<i class="fa fa-file-excel-o"></i>{$lang.export_data}', name : 'csv', bclass : 'csv', title : '{$lang.export_data}', onpress : fg_operate }
        ],
    	sortname: "amount",
    	sortorder: "desc",
    	title: '{$lang.integral_list}'
    });
});
function fg_operate(name, bDiv) {
	var itemlist = new Array();
	$('.trSelected',bDiv).each(function(){
		itemlist.push($(this).attr('data-id'));
	});
	if (name == 'del') {
	   if($('.trSelected',bDiv).length==0){
		   layer.msg(lang.no_selected_item);
			return false;
	   }
       fg_delete(itemlist, 'integral');
	}
	if(name == 'csv'){
		if($('.trSelected',bDiv).length==0){
		   layer.confirm(lang.download_all_data,{ icon: 3, title:lang.notice},function(index){
				fg_csv(itemlist, 'integral');
				layer.close(index);
			},function(index){
				layer.close(index);
			});
	   }else{
		   fg_csv(itemlist, 'integral');
	   }
	}
}
</script> 
{include file="footer.html"} 